{% macro render_field(name, label, type='text', value='', placeholder='', extra_classes='') %}
<label for="{{ name }}" class="form-label">{{ label }}</label>
<input type="{{ type }}"
       class="form-control {{ extra_classes }}"
       id="{{ name }}"
       name="{{ name }}"
       value="{{ value }}"
       {% if placeholder %}placeholder="{{ placeholder }}"{% endif %}>
{% endmacro %}

{% macro render_select(name, label, options, selected=None, extra_classes='') %}
<label for="{{ name }}" class="form-label">{{ label }}</label>
<select class="form-select {{ extra_classes }}" id="{{ name }}" name="{{ name }}">
    {% for option in options %}
    <option value="{{ option.value }}" {% if option.value == selected %}selected{% endif %}>
        {{ option.label }}
    </option>
    {% endfor %}
</select>
{% endmacro %}

{% macro render_checkbox(name, label, checked=False, extra_classes='') %}
<div class="form-check {{ extra_classes }}">
    <input type="checkbox"
           class="form-check-input"
           id="{{ name }}"
           name="{{ name }}"
           {% if checked %}checked{% endif %}>
    <label class="form-check-label" for="{{ name }}">
        {{ label }}
    </label>
</div>
{% endmacro %}
